//
//  TableViewCell.m
//  Project
//
//  Created by Suny on 14-12-15.
//  Copyright (c) 2014年 Suny. All rights reserved.
//

#import "TableViewCell.h"
#import "UIView+BaseFramework.h"
@interface TableViewCell() 
@property(nonatomic,strong) UIView *lineView;
@property(nonatomic,assign) UITableViewCellStyle style;
@end
@implementation TableViewCell

- (void)awakeFromNib {
    // Initialization code
}


- (void)baseSetup
{
    self.imageView.image = nil;
    self.imageView.hidden = YES;
    self.textLabel.text = nil;
    self.textLabel.hidden = YES;
    self.detailTextLabel.text = nil;
    self.detailTextLabel.hidden = YES;
}

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
	self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
	if (self)
   {
	   self.style = style;
//       [self baseSetup];

	   self.editingAccessoryType = UITableViewCellAccessoryNone;
	}
	return self;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (void)layoutSubviews
{
	[super layoutSubviews];

	if (!self.imageView.hidden) 
	{
		self . imageView . frame  = CGRectMake (20,5,self.height - 10,self.height - 10);
		self . imageView . contentMode  = UIViewContentModeScaleAspectFit ; 
		self . textLabel . left = self.imageView.right + 10;
	}


	if (self.style == UITableViewCellStyleSubtitle)
	{		
		self . detailTextLabel . left  = self.textLabel.left;   
	}
	  
	
	if (!_lineView)
	{
		_lineView = [[UIView alloc] initWithFrame:CGRectMake(0, self.height - 1, self.width, 1)];
		_lineView.backgroundColor = [UIColor colorWithRed:228/255.0 green:228/255.0 blue:228/255.0 alpha:1];
	}
		_lineView.frame = CGRectMake(0, self.height - 1, self.width, 1);
		[self addSubview:_lineView];
	_lineView.hidden = self.bottomLineHidden;
	
}

@end
